// src/QuestionList.tsx
import React, { useState } from 'react';

const questions = [
    '你们的服务时间是？',
    '如何联系客服？',
    '退款政策是什么？',
    // 其他问题...
];

const QuestionList: React.FC<{ onSelectQuestion: (question: string) => void }> = ({ onSelectQuestion }) => {
    const [expanded, setExpanded] = useState(false);

    return (
        <div>
            <button onClick={() => setExpanded(!expanded)}>
                {expanded ? '收起问题列表' : '展开问题列表'}
            </button>
            {expanded && (
                <ul>
                    {questions.map((question, index) => (
                        <li key={index} onClick={() => onSelectQuestion(question)} style={{ cursor: 'pointer' }}>
                            {question}
                        </li>
                    ))}
                </ul>
            )}
        </div>
    );
};

export default QuestionList;
